home *** CD-ROM | disk | FTP | other *** search
- Path: lrz-muenchen.de!sun2!ua302aa
- From: ua302aa@sun2.lrz-muenchen.de (Kurt Watzka)
- Newsgroups: comp.lang.c
- Subject: Re: HELP! File Pointers
- Date: 9 Jan 1996 10:23:42 GMT
- Organization: Leibniz-Rechenzentrum, Muenchen (Germany)
- Distribution: world
- Message-ID: <4ctfne$8lq@sparcserver.lrz-muenchen.de>
- References: <4csr4c$fem@newsbf02.news.aol.com>
- NNTP-Posting-Host: sun2.lrz-muenchen.de
-
- roberino@aol.com (Roberino) writes:
-
- >I am currently trying to keep one file open while opening other
- >files one at a time using a separate file pointer. However, as
-
- >Here are the steps I am performing:
-
- >void main()
- I will not comment on this!
- >{
- > FILE *File1;
- > FILE *File2;
-
- > File1 = fopen("FILENAME", "r+");
- >
- > /* loop through lines in File1 using fgets() */
-
- > if (Condition) /* just indicating some condition was met */
- > {
- > File2 = fopen("FILENAME2", "r+");
- >
- > fgets(Line, File2); <----- As soon as this occurs, File1 gets
- > wiped out. Why?
-
- The fgets() function in the standard C library takes three arguments.
- Your's doesn't, and there is no indication that there is a prototype
- for fgets() in scope. Line is undefined. So, what should be done with
- this program? It does not compile, and since you are obviously not
- talking about the fgets() function from the standard C library, what
- should we assume about "fgets()"?
-
- > }
- >}
-
- >Please send any and all replies through email to
- > roberino@aol.com.
- >I appreciate any and all help.
-
- If you also offer to post a summary, your chances to get E-mail
- replies micht improve slightly.
-
- Kurt
- --
- | Kurt Watzka Phone : +49-89-2180-6254
- | watzka@stat.uni-muenchen.de
- | ua302aa@sunmail.lrz-muenchen.de
-